<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script>
$(function(){
	$(".msg_show").click(function(){
		var url = $(this).attr("href");
		window.open(url,"쪽지 보기","width=250,height=280,menubar=no,toolbar=no, menubar=no, resizable=no,");
		return false;
	});
});
</script>
<div id="receiveBox">
    	<h2>받은 쪽지함</h2>
    		<c:choose>
    			<c:when test="${requestScope.list.list[0]==null }">
    				<p>받은 쪽지가 없습니다.</p>
    			</c:when>
	    		<c:otherwise>
		 			<table style="margin:0;">
		 			<thead>
		 				<tr style="margin:20px;">
		 					<th>보낸사람</th>
		 					<th>제목</th>
		 					<th>일시</th>
		 					<th>비고</th>
		 				</tr>
		 			</thead>
		 			<tbody>
						<c:forEach var="receive" items="${requestScope.list.list }">
						<tr style="margin:20px;">
							<td>
								${receive.from.nickname }
							</td>
							<td>
								<a href="sns.do?mode=receiveMsg&no=${receive.no }" class="msg_show">${receive.title }</a>
							</td>
							<td>${receive.w_date }</td>
							<td>
								<a href="sns.do?mode=deleteMsg&uid=${sessionScope.mvo.uId }&no=${receive.no }&boxType=receive">삭제</a>
							</td>
						</tr>
						</c:forEach>
					</tbody>			
		   			</table>
	   			</c:otherwise>
   			</c:choose>
   			<div id="receivePaging">
   			<c:set var="pb" value="${requestScope.list.pagingBean }"></c:set>
				<c:if test="${pb.previousPageGroup }">
						<a href="sns.do?mode=receiveMsgList&uid=${sessionScope.mvo.uId }&page=${pb.startPageOfPageGroup-1 }">
						<img src="${initParam.root }/img/left_arrow_btn.gif">
						</a>
						</c:if>	
				
					<c:forEach var="ppg" begin="${pb.startPageOfPageGroup}"	end="${pb.endPageOfPageGroup}" step="1">
					 <c:choose>
					 	<c:when test="${pb.nowPage!=ppg}">
					 		<a href="sns.do?mode=receiveMsgList&uid=${sessionScope.mvo.uId }&page=${ppg}">${ppg }</a>
					 	</c:when>
					    <c:otherwise>
						   ${ppg}
					    </c:otherwise>
				     </c:choose>
					</c:forEach>	 
				
				<c:if test="${pb.nextPageGroup }">
																<!-- 다음 그룹의 시작페이지 -->
				<a href="sns.do?mode=receiveMsgList&uid=${sessionScope.mvo.uId }&page=${pb.endPageOfPageGroup+1 }">
				<img src="${initParam.root }/img/right_arrow_btn.gif"></a>
				</c:if>
				</div>
    </div>